/*
 * @Author: ray
 * @Date:   2019-06-20 19:18:51
 * @Last Modified by:   ray
 * @Last Modified time: 2019-06-20 19:20:55
 */
const path = require("path");
module.exports = {
	mode: "development",
	// TODO: Add common Configuration
	module: {
		rules: [
			{
				test: /\.js$/,
				use: ["babel-loader?cacheDirectory=true"],
				include: path.join(__dirname, "src")
			},
			{
				test: /\.css$/,
				use: ["style-loader", "css-loader", "postcss-loader"]
			},
			{
				test: /\.(png|jpg|gif)$/,
				loader: "url-loader?limit=3000&name=imgs/[name][hash:5].[ext]"
			},
			{
				test: /\.(woff|svg|eot|ttf)$/,
				loader: "url-loader?name=fonts/[name].[hash:5:hex:7].[ext]"
			},
			{
				test: /\.scss$/,
				use: [
					"style-loader",
					"css-loader",
					"postcss-loader",
					"sass-loader",
					{
						loader: "sass-resources-loader",
						options: {
							resources: ["./src/css/ligw.scss"]
						}
					}
				]
			}
		]
	},

	devtool: "cheap-module-eval-source-map",
	watchOptions: {
		// 不监听这些文件
		ignored: /node_modules/
	},

	resolve: {
		alias: {
			pages: path.join(__dirname, "src/pages"),
			imgs: path.join(__dirname, "src/imgs"),
			utils: path.join(__dirname, "src/utils"),
			"@assets": path.resolve(__dirname, "src/imgs"),
			"@page": path.resolve(__dirname, "src/pages/ruijing"),
			"@ui": path.resolve(__dirname, "src/assets"),
			"@module": path.resolve(__dirname, "src/modules"),
			"@root": path.resolve(__dirname, "src")
		}
	}
};
